package com.yksj.healthtalk.ui.dictionary;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;

import com.yksj.healthtalk.comm.BaseFragmentActivity;
import com.yksj.healthtalk.ui.R;

/**
 * 
 * 医典
 * @author zhao
 *
 */
public class DictionaryMainActivity extends BaseFragmentActivity implements OnClickListener {
	
	LinearLayout mLinearLayout;
	View mSelectedV;
	
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		setContentView(R.layout.dictionary_main_layout);
		
		initTitle();
		
//		titleLeftBtn.setBackgroundResource(R.drawable.doctorbook_back);
		titleLeftBtn.setOnClickListener(this);
		titleTextV.setText("医学百科");
		
		mLinearLayout = (LinearLayout)findViewById(R.id.dictionary_liner);
		int count = mLinearLayout.getChildCount();
		for (int i = 0; i < count; i++) {
			mLinearLayout.getChildAt(i).setOnClickListener(this);
		}
	}
	
	@Override
	public void onClick(View v) {
		if(v.getId() != R.id.title_back){
			if(mSelectedV != null)mSelectedV.setSelected(false);
			mSelectedV = v;
			mSelectedV.setSelected(true);
		}
		switch(v.getId()){
		case R.id.title_back:
			onBackPressed();
			break;
		case R.id.item1://症状
			Intent intent = new Intent(this,DictionarySecendActivity.class);
			intent.putExtra("parame","1");
			intent.putExtra("title", "症状");
			startActivity(intent);
			break;
		case R.id.item7://药品
			intent = new Intent(this,DictionaryFirstLevelActivity.class);
			intent.putExtra("parame","2");
			intent.putExtra("title", "药品");
			startActivity(intent);
			break;
		case R.id.item2://检查
			intent = new Intent(this,DictionaryFirstLevelActivity.class);
			intent.putExtra("parame","3");
			intent.putExtra("title", "检查");
			startActivity(intent);
			break;
		case R.id.item8://手术
			intent = new Intent(this,DictionaryFirstLevelActivity.class);
			intent.putExtra("parame","8");
			intent.putExtra("title", "手术");
			startActivity(intent);
			break;
		case R.id.item3://疾病
			intent = new Intent(this,DictionaryFirstLevelActivity.class);
			intent.putExtra("parame","1");
			intent.putExtra("title", "疾病");
			startActivity(intent);
			break;
		case R.id.item5://医院
			intent = new Intent(this,DictionarySecendActivity.class);
			intent.putExtra("parame","5");
			intent.putExtra("title", "医院");
			startActivity(intent);
			break;
		case R.id.item4://科室
			intent = new Intent(this,DictionarySecendActivity.class);
			intent.putExtra("parame", "4");
			intent.putExtra("title", "科室");
			startActivity(intent);
			break;
		case R.id.item9://看病
			intent = new Intent(this,DictionaryFirstLevelActivity.class);
			intent.putExtra("parame","9");
			intent.putExtra("title", "附近就医");
			startActivity(intent);
			break;
		}
	}
	
	
	
}
